﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DTS
{
    class HistoriaSpolkiController
    {
        Dictionary<String, HistoriaSpolki> dane;

        public HistoriaSpolkiController()
        {
            dane = new Dictionary<String, HistoriaSpolki>();
        }
        public HistoriaSpolki getHistoriaSpolki(String symbol)
        {
            if (dane.ContainsKey(symbol))
                return dane[symbol];
            return null;
        }
        public bool addHistoriaSpolki(String symbol, HistoriaSpolki hs)
        {
            if (dane.ContainsKey(symbol))
                return false;
            dane.Add(symbol, hs);
            return true;
        }
        public bool addHistoriaSpolki(String symbol, List<Swieczka> swieczki)
        {
            if (dane.ContainsKey(symbol))
                return false;
            HistoriaSpolki toIns = new HistoriaSpolki(symbol, swieczki);
            dane.Add(symbol, toIns);
            return true;
        }
        public void clearDane()
        {
            dane.Clear();
        }
        public Dictionary<String, HistoriaSpolki> getDane()
        {
            return dane;
        }
        public HistoriaSpolki getHistoriaSpolki(String symbol, DateTime dataStart, DateTime dataEnd)
        {
            if (!dane.ContainsKey(symbol))
                return null;
            return dane[symbol].trim(dataStart, dataEnd);
        }
    }
}
